function Person(name, age, job) {
    this.name = name;
    this.age = age;
    this.job = job;
    this.sayName = function() {   // 定义的方法会在每个实例上都创建一遍
        console.log(this.name + ' Hello');
    };
};


Person.sayHi = function() {    // p1, p2共享了定义在全局作用域上的sayHi函数
    console.log(this.name + 'Hi');
};

let p1 = new Person('yyy', 18, 'student');
let p2 = new Person('yzd', 25, 'badman');

console.log(p1.sayName === p2.sayName);
console.log(p1.sayHi === p2.sayHi);   // true;

